import wyrequest from '@/utils/wyrequest'

const state={
    recommendList:[],
    categoryGroupList:[],
    fuShiXieBaoList:[]
}
const mutations={
    RECEIVE_RECOMMENDLIST(state,recommendList){
        state.recommendList = recommendList
    },
    RECEIVE_CATEGORYGROUPLIST(state,categoryGroupList){
        state.categoryGroupList = categoryGroupList
    },
    RECEIVE_FUSHIXIEBAOLIST(state,fuShiXieBaoList){
        state.fuShiXieBaoList = fuShiXieBaoList
    }
}
const actions={
    async getRecommendList({commit}){
        console.log ("getRecommendList请求函数执行了");
        const result = await wyrequest({
            url:"/item/cateList.json?__timestamp=1630131286110&categoryId=",
            methods:'get'
        });
        commit("RECEIVE_RECOMMENDLIST",result.data)
    },
    async getCategoryGroupList({commit}){
        console.log ("getCategoryGroupList请求函数执行了");
        const result = await wyrequest({
            url:"/item/cateList.json?__timestamp=1630131455012&categoryId=1005000",
            methods:'get'
        });
        commit("RECEIVE_CATEGORYGROUPLIST",result.data.categoryGroupList)
    },
    async getFuShiXieBaoList({commit}){
        console.log ("getFuShiXieBaoList请求函数执行了");
        const result = await wyrequest({
            url:"/item/cateList.json?__timestamp=1637633896313&categoryId=1010000",
            methods:'get'
        });
        commit("RECEIVE_FUSHIXIEBAOLIST",result.data.categoryGroupList)
    },
}
const getters={}
export default {
    state,
    mutations,
    actions,
    getters
}